 #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <Stdbool.h>


 struct TreeNode {
      int val;
      struct TreeNode *left;
      struct TreeNode *right;
  };

  struct TreeNode* flipTree(struct TreeNode* root) 
{
    if(root==NULL)
        return NULL;
    struct TreeNode* tmp = root->left;
    root->left = root->right;
    root->right = tmp;
    flipTree(root->left);
    flipTree(root->right);

    return root;
}